package com.elves.auth.config;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import lombok.NoArgsConstructor;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

import java.util.Map;

@Component
@Getter
@Setter
@Validated // 校验
@Configuration
@ConfigurationProperties(prefix = "app")
public class AppConfig {
    //应用名称
    private String name;
    // 线程池配置
    private Pool pool = new Pool();
    // 应用自定义可拓展配置
    private Map<String, String> args;

    @NoArgsConstructor
    @AllArgsConstructor
    @Getter
    @Setter
    public static class Pool {
        private String name;
        private String threadPrefix;
        private int corePoolSize;
        private int maxPoolSize;
        private int queueCapacity;
        private int keepAliveSeconds;
        private String rejectedExecutionHandler;
    }

}